﻿namespace CPL
{
    public static class ParallelSettings
    {
        /// <summary>
        /// Initializes the <see cref="ParallelSettings"/> class.
        /// </summary>
        static ParallelSettings()
        {
            _maxParallelismLevel = System.Environment.ProcessorCount;
            _minParallelismLevel = System.Environment.ProcessorCount;
            _priority = System.Threading.ThreadPriority.Normal;
            _isDebugRun = false;
        }

        private static int _minParallelismLevel;
        private static int _maxParallelismLevel;
        private static bool _isDebugRun;
        private static System.Threading.ThreadPriority _priority;

        /// <summary>
        /// Gets or sets a value indicating whether this instance is debug.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is debug; otherwise, <c>false</c>.
        /// </value>
        public static bool IsDebug
        {
            get { return _isDebugRun; }
            set { _isDebugRun = value; }
        }

        /// <summary>
        /// Gets or sets the min parallelism level.
        /// </summary>
        /// <value>
        /// The min parallelism level.
        /// </value>
        public static int MinParallelismLevel
        {
            get { return _minParallelismLevel; }
            set { _minParallelismLevel = value; }
        }

        /// <summary>
        /// Gets or sets the max parallelism level.
        /// </summary>
        /// <value>
        /// The max parallelism level.
        /// </value>
        public static int MaxParallelismLevel
        {
            get { return _maxParallelismLevel; }
            set { _maxParallelismLevel = value; }
        }

        /// <summary>
        /// Gets or sets the priority of thread execution.
        /// </summary>
        /// <value>
        /// The priority.
        /// </value>
        public static System.Threading.ThreadPriority Priority
        {
            get { return _priority; }
            set { _priority = value; }
        }
    }
}